<form class="form-horizontal" action="/gen/build" method="post">
	<input type="hidden" id="id" name="id" th:value="${model.id}" />
	<div class="form-group">
		<label for="name" class="col-sm-2 control-label">表名：</label>
		<div class="col-sm-4">
			<input type="text" class="btn btn-info" name="name" id="name"
				placeholder="表名" th:value="${model.name}" readonly="readonly" />
		</div>
		<label for="packageName" class="col-sm-2 control-label">类名：</label>
		<div class="col-sm-4">
			<input type="text" class="form-control" name="className"
				id="className" placeholder="类名" th:value="${model.className}" />
		</div>
	</div>
	<div class="form-group">
		<label for="category" class="col-sm-2 control-label">说明：</label>
		<div class="col-sm-4">
			<input type="text" class="form-control" name="comments" id="comments"
				placeholder="说明" th:value="${model.comments}" />
		</div>
		<label for="functionAuthor" class="col-sm-2 control-label">功能作者：</label>
		<div class="col-sm-4">
			<input type="text" class="form-control" name="functionAuthor"
				id="functionAuthor" placeholder="功能作者"
				th:value="${model.functionAuthor}" value="" />
		</div>
	</div>
	<div class="form-group">
		<label for="name" class="col-sm-2 control-label">包路径：</label>
		<div class="col-sm-4">
			<input type="text" class="form-control" name="packageName" id="packageName"
				placeholder="包路径" th:value="${model.packageName}" />
		</div>
		<label for="packageName" class="col-sm-2 control-label">模块名：</label>
		<div class="col-sm-4">
			<input type="text" class="form-control" name="moduleName"
				id="moduleName" placeholder="模块名" th:value="${model.moduleName}" />
		</div>
	</div>
	<div class="form-group">
		<label for="moduleName" class="col-sm-2 control-label">父表表名：</label>
		<div class="col-sm-4">
			<select name="parentTable" class="form-control">
			    <option value="">暂无</option>
				<option th:each="dict:${tableList}" 
						th:value="${dict.name}"
						th:selected="${dict.name==model.parentTable}"
						th:text="${dict.nameAndComments}"></option>
			</select>
		</div>
		<label for="subModuleName" class="col-sm-2 control-label">当前表外键：</label>
		<div class="col-sm-4">
			<select name="parentTableFk" class="form-control">
				<option value="">暂无</option>
				<option th:each="dict:${model.columnList}" 
				        th:value="${dict.name}"
				        th:selected="${dict.name==model.parentTableFk}"
						th:text="${dict.nameAndComments}"></option>
			</select>
		</div>
	</div>

	

	<div class="control-group">
		<table id="contentTable"
			class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
					<th title="数据库字段名">列名</th>
					<th title="默认读取数据库字段备注">说明</th>
					<th title="数据库中设置的字段类型及长度">物理类型</th>
					<th title="实体对象的属性字段类型">Java类型</th>
					<th
						title="实体对象的属性字段（对象名.属性名|属性名2|属性名3，例如：用户user.id|name|loginName，属性名2和属性名3为Join时关联查询的字段）">Java属性名称
						<i class="icon-question-sign"></i>
					</th>
					<th title="是否是数据库主键" style="width:40px;">主键</th>
					<th title="字段是否可为空值，不可为空字段自动进行空值验证" style="width:40px;">可空</th>
					<th title="选中后该字段被加入到insert语句里" style="width:40px;">插入</th>
					<th title="选中后该字段被加入到update语句里" style="width:40px;">编辑</th>
					<th title="选中后该字段被加入到查询列表里" style="width:40px;">列表</th>
					<th title="选中后该字段被加入到查询条件里" style="width:40px;">查询</th>
					<th title="该字段为查询字段时的查询匹配放松">查询匹配方式</th>


					<th style="width: 70px;">排序</th>
				</tr>
			</thead>
			<tbody>

				<tr th:each="column,state:${model.columnList}">
					<input type="hidden" th:name="${'columnList['+state.index+'].id'}"
						th:value="${column.id}" />
					<input type="hidden"
						th:name="${'columnList['+state.index+'].delFlag'}"
						th:value="${column.delFlag}" />
					<input type="hidden"
						th:name="${'columnList['+state.index+'].genTable.id'}"
						th:value="${column.genTable == null ?'':column.genTable.id}" />
					<input type="hidden"
						th:name="${'columnList['+state.index+'].name'}"
						th:value="${column.name}" />
					<input type="hidden"
						th:name="${'columnList['+state.index+'].jdbcType'}"
						th:value="${column.jdbcType}" />
					<td th:text="${column.name}"></td>
					<td><input type="text" class="form-control"
						th:name="${'columnList['+state.index+'].comments'}"
						th:value="${column.comments}" /></td>
					<td th:text="${column.jdbcType}"></td>
					<td>
					 <select class="form-control"
						th:name="${'columnList['+state.index+'].javaType'}">
						<option th:each="dict:${config.javaTypeList}"
								th:value="${dict.value}" 
								th:title="${dict.description}"
								th:selected="${dict.value==column.javaType}"
								th:text="${dict.label}"></option>
					</select></td>
					<td><input type="text" class="form-control"
						th:name="${'columnList['+state.index+'].javaField'}"
						th:value="${column.javaField}" /></td>
					<td><input type="checkbox" th:value="1" class="form-control"
						th:name="${'columnList['+state.index+'].isPk'}"
						th:checked="${column.isPk eq '1' ? 'true' : 'false'}" /></td>
					<td><input type="checkbox"
						th:name="${'columnList['+state.index+'].isNul'}" th:value="1"
						class="form-control"
						th:checked="${column.isNull} == '1' ? 'true' : 'false' " /></td>
					<td><input type="checkbox" th:value="1" class="form-control"
						th:name="${'columnList['+state.index+'].isInsert'}"
						th:checked="${column.isInsert eq '1' ? 'true' : 'false'}" /></td>
					<td><input type="checkbox" th:value="1" class="form-control"
						th:name="${'columnList['+state.index+'].isEdit'}"
						th:checked="${column.isEdit eq '1' ? 'true' : 'false'}" /></td>
					<td><input type="checkbox" th:value="1" class="form-control"
						th:name="${'columnList['+state.index+'].isList'}"
						th:checked="${column.isList eq '1' ? 'true' : 'false'}" /></td>
					<td><input type="checkbox" th:value="1" class="form-control"
						th:name="${'columnList['+state.index+'].isQuery'}"
						th:checked="${column.isQuery eq '1' ? 'true' : 'false'}" /></td>
					<td><select
						th:name="${'columnList['+state.index+'].queryType'}"
						class="form-control">
							
							<option th:each="dict,dStat:${config.queryTypeList}"
								th:value="${dict.value}" th:title="${dict.description}"
								th:selected="${dict.value==column.queryType}"
								th:text="${dict.label}"></option>
					</select></td>


					<td><input type="text"
						th:name="${'columnList['+state.index+'].sort'}"
						th:value="${column.sort}" class="form-control" /></td>
				</tr>

			</tbody>
		</table>
	</div>

</form>
<script type="text/javascript">
  $('select').select2();
</script>